package android.slc.appbase.ui.view

import android.slc.box.commonlibrary.compat.SlcResourceUtils
import javafx.scene.Node
import javafx.scene.control.Button

open class AppGeneralActionViewHelper(val actionParent: Node) {

    init {
        this.actionParent.lookup("#btnCancel")?.let {
            if (it is Button) {
                it.text = SlcResourceUtils.getString("action_cancel")
                it.setOnAction {
                    onCancel()
                }
            }
        }
        this.actionParent.lookup("#btnOk")?.let {
            if (it is Button) {
                it.text = SlcResourceUtils.getString("action_ok")
                it.setOnAction {
                    onOk()
                }
            }
        }
    }

    protected open fun onCancel() {

    }

    protected open fun onOk() {

    }
}
